package com.companion.lh.app

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.amap.api.maps.MapView
import com.amap.api.maps.model.MyLocationStyle
import com.companion.lh.companion_app.R
import android.widget.ArrayAdapter
import com.companion.lh.app.model.Position
import kotlinx.android.synthetic.main.activity_search_place.*


class SearchPlaceActivity : AppCompatActivity() {
    private var mapView: MapView? = null
    private var position:Position? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_search_place)
        mapView = searchPlaceMap as MapView
        mapView?.onCreate(savedInstanceState)
        //初始化地图
        initMap()
        updateAutoCompleteList()
    }

    private fun updateAutoCompleteList(){
        val arr = arrayOf("aa", "aab", "aac")
        val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, arr)
        addressAct.setAdapter(adapter)
    }

    private fun cancel(){

    }

    private fun initMap() {
        var aMap = mapView?.map
        var myLocationStyle = MyLocationStyle()
        myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW)
        myLocationStyle.interval(2000)
        aMap?.myLocationStyle = myLocationStyle
        aMap?.isMyLocationEnabled = true
    }
}
